﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApplication.Class
{
    public class Person
    {
        public Person(string lastName, string firstName, int age,DateTime date)
        {
            this.LastName = lastName;
            this.FirstName = firstName;
            this.Age = age;
            this.Date = date;
        }
        public string LastName
        {
            get;
            set;
        }

        public string FirstName
        {
            get;
            set;
        }

        public int Age
        {
            get;
            set;
        }

        public DateTime Date
        {
            get;
            set;
        }
    }

    class BindingSourcePerson
    {
        Person person;
        public BindingSourcePerson(Person person)
        {
            this.person = person;
        }

        public string LastName
        {
            get { return person.LastName; }
            set { person.LastName = value; }
        }

        public string FirstName
        {
            get { return person.FirstName; }
            set { person.FirstName = value; }
        }

        public int Age
        {
            get { return person.Age; }
            set { person.Age = value; }
        }

        public DateTime Date
        {
            get { return person.Date; }
            set 
            {
                person.Date = new DateTime(value.Year, value.Month, value.Day, person.Date.Hour, person.Date.Minute, person.Date.Second);
            }
        }

        public DateTime Time
        {
            get { return person.Date; }
            set
            {
                person.Date = new DateTime(person.Date.Year, person.Date.Month, person.Date.Day, value.Hour, value.Minute, value.Second);
            }
        }
    }
}
